/* model */
import { 
  SettingGPTRobotInsideModuleTask,
  SettingGPTRobotInsideModuleWiki, 
  SettingGPTRobotModelModule3_5, 
  SettingGPTRobotModelModule3_5Turbo, 
  SettingGPTRobotModelModule4, 
  SettingGPTRobotModelModule4Turbo, 
  SettingGPTRobotModelModuleTongYi, 
  SettingGPTRobotPluginModules,
  SettingGPTRobotServiceModules
} from "@src/modules/setting/gpt/model/modules";
/* types */
import { AIChatRobotAppItemComponentType, AIChatRobotItemComponentType, SettingGPTRobotModuleType, SettingGPTServiceItem } from "@src/modules/setting/gpt/types";
import { cloneDeep } from "@src/util/type";
/* enum */
import { SettingGPTRobotModelModuleEnum, SettingGPTServiceTypeEnum, SettingGPTServiceTypeEnumCNNameEnum, SettingGPTTranslateToLanguageEnum } from "@gpt/model/enum";

const DefaultRobotItem: AIChatRobotItemComponentType = {
  id: null,
  icon: '',
  name: '',
  description: '',
  robotNo: '',
  enable: 0,
  setting: {
    share: false,
    modelName: SettingGPTRobotModelModuleEnum.TongYi,
    insideModuleConfig: {
      enable: true,
      modules: [
        {
          ...SettingGPTRobotInsideModuleWiki,
          disabled: false,
          show: true
        },
        {
          ...SettingGPTRobotInsideModuleTask,
          show: true,
        }
      ]
    },
    outsideModuleConfig: {
      enable: false,
      modules: []
    },
    urlModuleConfig: {
      enable: false,
      modules: []
    },
    commonModuleConfig: {
      enable: true,
      disabled: true,
      modules: [
        {
          ...SettingGPTRobotModelModule4Turbo,
          show: true,
        },
        {
          ...SettingGPTRobotModelModuleTongYi,
          show: true,
        }
      ]
    },
    pluginModuleConfig: {
      enable: false,
      modules: cloneDeep(SettingGPTRobotPluginModules).map((item: SettingGPTRobotModuleType) => {
        item.show = true
        return item
      })
    }
  }
}

const DefaultRobotAppItem: AIChatRobotAppItemComponentType = {
  id: '',
  setting: {
    translateToLanguage: SettingGPTTranslateToLanguageEnum.English,
    promptWordList: [
      {
        title: '',
        content: '',
      },
      {
        title: '',
        content: '',
      }
    ],
    insideModuleConfig: {
      enable: true,
      modules: [
        {
          ...SettingGPTRobotInsideModuleWiki,
          disabled: false,
          show: true,
          showSetting: true
        },
        {
          ...SettingGPTRobotInsideModuleTask,
          show: true,
        }
      ]
    },
    outsideModuleConfig: {
      enable: false,
      modules: []
    }
  }
}

const DefaultRobotServiceTypeList: string[] = [
  SettingGPTServiceTypeEnum.Common,
  SettingGPTServiceTypeEnum.Intelligent
]

const SettingGPTServiceTypeSettingEnum: Record<string, {
  name: string,
  description: string,
  descriptionBottom?: string,
  icon: string,
  system: boolean,
  hasUrl?: boolean,
}> = {
  [SettingGPTServiceTypeEnum.Common]: {
    name: SettingGPTServiceTypeEnumCNNameEnum[SettingGPTServiceTypeEnum.Common],
    description: '写文案、做总结，做你的全方位的服务提效助手。',
    descriptionBottom: '适用场景：通识问答、文案润色/扩写、售后宝操作指南',
    icon: '',
    system: true,
    hasUrl: false
  },
  [SettingGPTServiceTypeEnum.Intelligent]: {
    name: SettingGPTServiceTypeEnumCNNameEnum[SettingGPTServiceTypeEnum.Intelligent],
    description: '基于企业沉淀的专属知识进行查询和问答。',
    descriptionBottom: '适用场景：客服答疑、工程师维修知识问答',
    icon: '',
    system: true,
    hasUrl: true
  },
  [SettingGPTServiceTypeEnum.BI]: {
    name: SettingGPTServiceTypeEnumCNNameEnum[SettingGPTServiceTypeEnum.BI],
    description: '一句话即可制作报表，让您从繁琐的报表制作中解放出来。',
    descriptionBottom: '适用场景：部门汇报、周报统计等报表制作',
    icon: '',
    system: false,
    hasUrl: true
  },
  [SettingGPTServiceTypeEnum.ChineseToEnglish]: {
    name: SettingGPTServiceTypeEnumCNNameEnum[SettingGPTServiceTypeEnum.ChineseToEnglish],
    description: '帮助您服务来自不同语种、不同国家的客户，开始企业全球服务之路。',
    descriptionBottom: '适用场景：海外客户服务等场景',
    icon: '',
    system: false,
    hasUrl: true
  },
  [SettingGPTServiceTypeEnum.Summary]: {
    name: SettingGPTServiceTypeEnumCNNameEnum[SettingGPTServiceTypeEnum.Summary],
    description: '针对某个业务模块进行摘要，支持批量摘要',
    descriptionBottom: '适用场景：工单摘要等场景',
    icon: '',
    system: false,
    hasUrl: false
  }
}

const RobotServiceList: SettingGPTServiceItem[] = [
  {
    ...SettingGPTServiceTypeSettingEnum[SettingGPTServiceTypeEnum.Common],
    type: SettingGPTServiceTypeEnum.Common,
    isCommon: true,
    disabled: false,
    show: true,
  },
  {
    ...SettingGPTServiceTypeSettingEnum[SettingGPTServiceTypeEnum.Intelligent],
    type: SettingGPTServiceTypeEnum.Intelligent,
    disabled: false,
    isCommon: true,
    show: true,
  },
  {
    ...SettingGPTServiceTypeSettingEnum[SettingGPTServiceTypeEnum.BI],
    type: SettingGPTServiceTypeEnum.BI,
    disabled: false,
    isCommon: false,
    show: true,
  },
  {
    ...SettingGPTServiceTypeSettingEnum[SettingGPTServiceTypeEnum.ChineseToEnglish],
    type: SettingGPTServiceTypeEnum.ChineseToEnglish,
    disabled: false,
    isCommon: false,
    show: false,
  },
  {
    ...SettingGPTServiceTypeSettingEnum[SettingGPTServiceTypeEnum.Summary],
    type: SettingGPTServiceTypeEnum.Summary,
    disabled: false,
    isCommon: false,
    show: false,
  }
]

export {
  RobotServiceList,
  DefaultRobotServiceTypeList,
  DefaultRobotItem,
  DefaultRobotAppItem,
  SettingGPTServiceTypeSettingEnum
}
